<div class="page" loaded="bindCols">
	<div class="pageContent">
		<form class="pageForm" onsubmit="return dialogCallback(this,selectCheckeds)">
			<div class="pageFormContent" layoutH="57" category_id="{category_id}" sign="{sign}"></div>
			<input name="show_fields" style="display: none" />
			<div class="formBar">
				<ul>
					<li><div class="buttonActive">
							<div class="buttonContent">
								<button type="submit" class="ok">确定</button>
							</div>
						</div></li>
					<li><div class="button">
							<div class="buttonContent">
								<button type="button" class="close">取消</button>
							</div>
						</div></li>
				</ul>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
	function bindCols($dom) {
		var cont = $(".pageFormContent", $dom);
		bindUsedFields(cont.attr("category_id"),cont);
	}
	
	function selectCheckeds(form){
		var $boxs=$(":checkbox[checked=true]",form);
		var items=[];
		$boxs.each(function(){
			items.push(this.value);
		})
		
		if(items.join(",").length>128){
			alertMsg.error("显示字段过多，请重新设置！");
			return false;
		}
		
		$("input[name=show_fields]").val(items.join(","));
		var categoryId = $(".pageFormContent",form).attr("category_id"),sign=$(".pageFormContent",form).attr("sign");
		var url = "category/"+categoryId+"/extdefined?show_fields="+items.join(",")+"&sign="+sign;
		DWZ.put(url,function(data){
			//alertMsg.correct("更新成功");
		},false);
		return items;
	}
</script>